<!DOCTYPE html>

<html class="no-js">

<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <title></title>
  <meta name="description" content="" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <script src="https://cdn.staticfile.org/axios/0.19.0-beta.1/axios.js"></script>
  <script src="../../cdn/vue/vue.global.min.js"></script>
  <link rel="stylesheet" href="../../cdn/element-plus/index.css" />
  <script src="../../cdn/element-plus/index.full.min.js"></script>
  <script src="https://www.avuejs.com/cdn/aliyun-oss-sdk.min.js"></script>
  <!-- 导入表格需要的包 -->

  <script src="https://cdn.staticfile.org/FileSaver.js/2014-11-29/FileSaver.min.js"></script>
  <script src="https://avuejs.com/cdn/xlsx.full.min.js"></script>

  <link rel="stylesheet" href="../../../lib/index.css" />
  <script src="../../../lib/avue.js"></script>
</head>

<body>
  <div id="app">
    <avue-crud :option="option" :data="data" v-model:page="page" @on-load="onLoad"></avue-crud>
  </div>
</body>

</html>

<script>
  var app = Vue.createApp({
    data() {
      return {
        page: {
          pageSize: 20
        },
        option: {
          border: true,
          index: true,
          expandLevel: 3,
          headerAlign: 'center',
          excelBtn: true,
          align: 'center',
          rowKey: 'id',
          labelWidth: 100,
          column: [{
            width: 150,
            label: '姓名',
            prop: 'name',
          }, {
            label: '性别1',
            prop: 'sex',
          },
          {
            label: '自定义图标',
            prop: 'icon',
            type: "icon",
            iconList: [{
              label: '基本图表',
              list: ['el-icon-time', 'el-icon-bell', 'el-icon-star-on']
            }]
          }, {
            label: '复杂表头',
            children: [{
              label: '信息',
              children: [{
                label: '年龄',
                prop: 'age'
              }, {
                label: '手机号',
                prop: 'phone',
              }, {
                label: '单位：天',
                children: [
                  {
                    label: 'D1-D3天数', children: [{
                      label: 'D1天数', prop: 'd1day', type: 'number', minWidth: '100', minRows: 0, span: 24
                    }, {
                      label: 'D2天数', prop: 'd2day', type: 'number', minWidth: '100', minRows: 0, span: 24
                    }, {
                      label: 'D3天数', prop: 'd3day', type: 'number', minWidth: '100', minRows: 0, span: 24
                    }]
                  },
                  { label: 'D4天数', prop: 'd4day', type: 'number', minWidth: '100', minRows: 0, span: 24 },
                  { label: 'D5天数', prop: 'd5day', type: 'number', minWidth: '100', minRows: 0, span: 24 },
                  { label: 'D6天数', prop: 'd6day', type: 'number', minWidth: '100', minRows: 0, span: 24 },
                  { label: 'D7天数', prop: 'd7day', type: 'number', minWidth: '100', minRows: 0, span: 24 },
                  { label: 'D8天数', prop: 'd8day', type: 'number', minWidth: '100', minRows: 0, span: 24 },
                ]
              }]
            }, {
              label: '级别',
              prop: 'grade',
              type: 'select',
              dicUrl: `https://cli.avuejs.com/api/area/getProvince`,
              props: {
                label: 'name',
                value: 'code'
              },
            }]
          }, {
            label: '测试',
            prop: 'test',
          },
          {
            label: '手机信息1',
            prop: 'phone1'
          }]
        },
        data: [{
          id: 1,
          name: '张三',
          age: 14,
          grade: '110000',
          phone1: '17547400800',
          phone: '17547400800',
          icon: 'el-icon-time',
          test: 1,
          sex: '男',
          children: [{
            id: 2,
            name: '李四',
            age: 20,
            grade: 1,
            sex: '男',
            test: 1,
            phone1: '17547400800',
            phone: '17547400800',
            icon: 'el-icon-user',
            children: [{
              id: 3,
              name: '王五',
              age: 10,
              grade: 1,
              test: 1,
              sex: '女',
              icon: 'el-icon-star-on',
              phone1: '17547400800',
              phone: '17547400800'
            }]
          }]
        }, {
          id: 4,
          name: '王五',
          age: 10,
          grade: 1,
          test: 1,
          sex: '女',
          icon: 'el-icon-star-on',
          phone1: '17547400800',
          phone: '17547400800'
        }]
      }
    },
    methods: {
      onLoad(page) {
        //模拟分页
        this.page.total = 40
      }
    }
  })
  app.use(ElementPlus)
  app.use(AVUE)
  app.mount('#app')
</script>